<?php /*

  This file is part of a child theme called AI编程网站模版.
  Functions in this file will be loaded before the parent theme's functions.
  For more information, please read
  https://developer.wordpress.org/themes/advanced-topics/child-themes/

*/

// this code loads the parent's stylesheet (leave it in place unless you know what you're doing)

function your_theme_enqueue_styles() {

    $parent_style = 'parent-style';

    wp_enqueue_style( $parent_style, 
      get_template_directory_uri() . '/style.css'); 

    wp_enqueue_style( 'child-style', 
      get_stylesheet_directory_uri() . '/style.css', 
      array($parent_style), 
      wp_get_theme()->get('Version') 
    );
}

add_action('wp_enqueue_scripts', 'your_theme_enqueue_styles');

/*  Add your own functions below this line.
    ======================================== */ 

function enqueue_chat_scripts() {
    wp_enqueue_style('chat-style', get_stylesheet_directory_uri() . '/chat.css');
    wp_enqueue_script('chat-script', get_stylesheet_directory_uri() . '/chat.js', array('jquery'), '1.0', true);
    wp_localize_script('chat-script', 'chatAjax', array(
        'ajaxurl' => get_stylesheet_directory_uri() . '/chat-api.php'
    ));
}
add_action('wp_enqueue_scripts', 'enqueue_chat_scripts');

function add_chat_box() {
    ?>
    <div id="ai-chat-box" class="chat-box">
        <div class="chat-header">
            <span>AI Assistant</span>
            <button class="minimize-btn">-</button>
        </div>
        <div class="chat-messages"></div>
        <div class="chat-input">
            <textarea placeholder="Type your message..."></textarea>
            <button class="send-btn">Send</button>
        </div>
    </div>
    <?php
}
add_action('wp_footer', 'add_chat_box');

